package com.com.ruandi.test15;

//矩形类
public class Rectangle extends Graphic{
    private double width;
    private double height;
    public Rectangle() {
    }
    public Rectangle(double width, double height) {
        this.width = width;
        this.height = height;
    }
    public double getWidth() {
        return width;
    }
    public void setWidth(double width) {
        this.width = width;
    }
    public double getHeight() {
        return height;
    }
    public void setHeight(double height) {
        this.height = height;
    }

    @Override
    public int hashCode() {
        return super.hashCode();
    }

    @Override
    public boolean equals(Object obj) {
        return super.equals(obj);
    }

    @Override
    public String toString() {
        return "三角形\n" +
                "宽为：" + width +
                ",长为：" + height
                +"\n";
    }
    //面积方法
    @Override
    public double getArea() {
        return height* width;
    }
    //周长方法
    @Override
    public double getPerimeter() {
        return 2*(height+width);
    }

    @Override
    public String showInfo() {
        return "矩形";
    }
}
